package net.chenlin.dp.base.service.impl;

import net.chenlin.dp.base.entity.DictTableEntity;
import net.chenlin.dp.base.manager.DictTableManager;
import net.chenlin.dp.base.service.DictTableService;
import net.chenlin.dp.common.entity.Page;
import net.chenlin.dp.common.entity.Query;
import net.chenlin.dp.common.entity.R;
import net.chenlin.dp.common.utils.CommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 字段字典表
 *
 * @author ZhouChenglin
 * @email yczclcn@163.com
 * @url www.chenlintech.com
 * @date 2018年2月02日 下午4:34:44
 */
@Service("dictTableService")
public class DictTableServiceImpl implements DictTableService {


	@Autowired
	private DictTableManager dictTableManager;
	@Override
	public List<DictTableEntity> listByIds(Long  [] ids) {
		return  dictTableManager.listByIds(ids);

	}

	@Override
	public Page<DictTableEntity> listDpTableColum(Map<String, Object> params) {
		Query query = new Query(params);
		Page<DictTableEntity> page = new Page<>(query);
		dictTableManager.listDpTableColum(page, query);
		return page;
	}

	@Override
	public R saveDpTableColum(DictTableEntity role) {
		int count = dictTableManager.saveDpTableColum(role);
		return CommonUtils.msg(count);
	}

	@Override
	public R getDpTableColumById(Long id) {
		DictTableEntity dpTableColum = dictTableManager.getDpTableColumById(id);
		return CommonUtils.msg(dpTableColum);
	}

	@Override
	public R updateDpTableColum(DictTableEntity dpTableColum) {
		int count = dictTableManager.updateDpTableColum(dpTableColum);
		return CommonUtils.msg(count);
	}

	@Override
	public R batchRemove(Long[] id) {
		int count = dictTableManager.batchRemove(id);
		return CommonUtils.msg(id, count);
	}

}
